#! /usr/bin/python
#coding:utf-8
__author__ = 'guolt'

import tempfile
import os

#创建临时文件

with tempfile.NamedTemporaryFile(mode='w+b') as f:
    print f
    print "tmp file name is: ",f.name
    f.write('hello world!')
    f.seek(0)

    print f.read()
#    print tempfile.gettempdir()
#    print tempfile.gettempprefix()



#创建临时目录
"""
dirname=tempfile.mkdtemp()
print dirname
os.removedirs(dirname)
"""




